Skip to content

cast_possible_truncation: Support size_of, align_of, and size_of_val #15488

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

RunDevelopment
Copy link

@RunDevelopment RunDevelopment commented Aug 14, 2025

fixes parts of #9613, related to #12962

Unlike #12962, I added support for size_of, align_of, and size_of_val to ConstEval, so all lints using it benefit from this change.

cast_possible_truncation itself changed relatively little. Functions calls are now delegated to const eval and ptr-sized to fixed-sized casts now consider from_nbits.

changelog: [cast_possible_truncation]: support size_of, align_of, and size_of_val


My intention with this PR is not to superceed #12962, but to get in a simple improvement while I work on #15342.

@rustbot
Copy link
Collaborator

rustbot commented Aug 14, 2025

r? @blyxyas

rustbot has assigned @blyxyas.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Aug 14, 2025
Copy link

github-actions bot commented Aug 14, 2025

Lintcheck changes for c5a67a8

Lint Added Removed Changed
clippy::arithmetic_side_effects 0 46 5
clippy::assertions_on_constants 1 0 0
clippy::cast_possible_truncation 0 13 2
clippy::eq_op 7 0 0
clippy::identity_op 3 0 0
clippy::if_same_then_else 1 0 0

This comment will be updated if you push new changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants